home *** CD-ROM | disk | FTP | other *** search
- Docs for Prmpt.com - batch file query utility
- R. Trevithick, 12/06/87
-
-
- This little (104 byte) assembler module allows you to query the user
- from within a batch file.
-
- The syntax is PRMPT "string to display",list of single keys allowed
-
- Example:
-
- prmpt "Do you wish to proceed (Y/N) ? ",yn
-
- This would cause the part within the quotes to be displayed, and would
- then wait for the user to press either y or n (case does not matter).
-
- If the user pressed y, errorlevel 1 would be returned, and n would cause
- errorlevel 2. Your batch file can, of course, test for these errorlevel
- codes and proceed accordingly.
-
- There is one option available. If you use single quotes (') instead of
- double ("), the user will not be able to exit by pressing ctrl-c or
- ctrl-break. The double quotes use service 8h and the single quotes use
- service 7h. Note that these services do not echo characters to the
- screen.
-
- The following batch file displays a typical way of using this:
-
-
- prmpt 'Do you want to proceed (Yes/No/Abort) ? ',yna
- if errorlevel 3 echo Abort
- if errorlevel 3 goto END
- if errorlevel 2 echo No
- if errorlevel 2 goto END
- if errorlevel 1 echo Yes
- :END
-
-
- This will merely print out the word which corresponds to the user's
- choice, demonstrating how to use the errorlevel condition testing within
- a batch file. The example above uses single quotes around the prompt
- (message) part of the command, so control-break will not allow exit.
-
-
- Note: Do not include a space after the comma unless you actually want
- the space character to be included in the list of valid responses. Also
- note that virtually no error testing is done, in the interest of keeping
- the .com file small. If you just invoke it without any parameters, it
- will exit immediately without setting an errorlevel. But if you invoke
- it with only part of what it needs (e.g., a quoted message but no key
- selection list) it will use whatever garbage it finds already in memory.
-
-
- ------Changes as of 12/03/87 revision----------
-
- -Added code to detect and absorb dual scan code keys such as function
- keys.
-
-